Imports cmplib01

Public Class frmElementManager
    Inherits System.Windows.Forms.Form

    Private ptrCGD As CampaignerGameData
    Private c_Module As String = "frmElementManager"
    Private currentShowMode As ShowMode = ShowMode.ElementTypes

    Private Enum ShowMode
        ElementTypes = 1
        Options = 2
    End Enum

#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    Friend WithEvents btnOK As System.Windows.Forms.Button
    Friend WithEvents pnlElementClasses As System.Windows.Forms.Panel
    Friend WithEvents lstExistingElementClasses As System.Windows.Forms.ListBox
    Friend WithEvents btnRemoveClass As System.Windows.Forms.Button
    Friend WithEvents btnAddClass As System.Windows.Forms.Button
    Friend WithEvents btnEdit As System.Windows.Forms.Button
    Friend WithEvents lblElementClasses As System.Windows.Forms.Label
    Friend WithEvents Panel1 As System.Windows.Forms.Panel
    Friend WithEvents btnEditElement As System.Windows.Forms.Button
    Friend WithEvents btnAddElement As System.Windows.Forms.Button
    Friend WithEvents btnRemoveElement As System.Windows.Forms.Button
    Friend WithEvents cboElementClass As System.Windows.Forms.ComboBox
    Friend WithEvents lblElementClass As System.Windows.Forms.Label
    Friend WithEvents lstElementTypes As System.Windows.Forms.ListBox
    Friend WithEvents pnlElementTypesOptions As System.Windows.Forms.Panel
    Friend WithEvents btnTypes As System.Windows.Forms.Button
    Friend WithEvents btnOptions As System.Windows.Forms.Button
    Friend WithEvents lstOptionTypes As System.Windows.Forms.ListBox
    Friend WithEvents lblListName As System.Windows.Forms.Label
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.btnOK = New System.Windows.Forms.Button
        Me.pnlElementClasses = New System.Windows.Forms.Panel
        Me.lblElementClasses = New System.Windows.Forms.Label
        Me.btnEdit = New System.Windows.Forms.Button
        Me.btnAddClass = New System.Windows.Forms.Button
        Me.btnRemoveClass = New System.Windows.Forms.Button
        Me.lstExistingElementClasses = New System.Windows.Forms.ListBox
        Me.Panel1 = New System.Windows.Forms.Panel
        Me.lstOptionTypes = New System.Windows.Forms.ListBox
        Me.lblElementClass = New System.Windows.Forms.Label
        Me.cboElementClass = New System.Windows.Forms.ComboBox
        Me.lblListName = New System.Windows.Forms.Label
        Me.btnEditElement = New System.Windows.Forms.Button
        Me.btnAddElement = New System.Windows.Forms.Button
        Me.btnRemoveElement = New System.Windows.Forms.Button
        Me.lstElementTypes = New System.Windows.Forms.ListBox
        Me.pnlElementTypesOptions = New System.Windows.Forms.Panel
        Me.btnOptions = New System.Windows.Forms.Button
        Me.btnTypes = New System.Windows.Forms.Button
        Me.pnlElementClasses.SuspendLayout()
        Me.Panel1.SuspendLayout()
        Me.pnlElementTypesOptions.SuspendLayout()
        Me.SuspendLayout()
        '
        'btnOK
        '
        Me.btnOK.FlatStyle = System.Windows.Forms.FlatStyle.Flat
        Me.btnOK.Location = New System.Drawing.Point(240, 464)
        Me.btnOK.Name = "btnOK"
        Me.btnOK.Size = New System.Drawing.Size(75, 23)
        Me.btnOK.TabIndex = 0
        Me.btnOK.Text = "OK"
        '
        'pnlElementClasses
        '
        Me.pnlElementClasses.BackColor = System.Drawing.SystemColors.ControlLight
        Me.pnlElementClasses.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.pnlElementClasses.Controls.Add(Me.lblElementClasses)
        Me.pnlElementClasses.Controls.Add(Me.btnEdit)
        Me.pnlElementClasses.Controls.Add(Me.btnAddClass)
        Me.pnlElementClasses.Controls.Add(Me.btnRemoveClass)
        Me.pnlElementClasses.Controls.Add(Me.lstExistingElementClasses)
        Me.pnlElementClasses.Location = New System.Drawing.Point(8, 8)
        Me.pnlElementClasses.Name = "pnlElementClasses"
        Me.pnlElementClasses.Size = New System.Drawing.Size(312, 176)
        Me.pnlElementClasses.TabIndex = 7
        '
        'lblElementClasses
        '
        Me.lblElementClasses.Location = New System.Drawing.Point(8, 8)
        Me.lblElementClasses.Name = "lblElementClasses"
        Me.lblElementClasses.Size = New System.Drawing.Size(184, 16)
        Me.lblElementClasses.TabIndex = 4
        Me.lblElementClasses.Text = "Element Classes"
        '
        'btnEdit
        '
        Me.btnEdit.FlatStyle = System.Windows.Forms.FlatStyle.Flat
        Me.btnEdit.Location = New System.Drawing.Point(224, 144)
        Me.btnEdit.Name = "btnEdit"
        Me.btnEdit.Size = New System.Drawing.Size(75, 23)
        Me.btnEdit.TabIndex = 3
        Me.btnEdit.Text = "Edit"
        '
        'btnAddClass
        '
        Me.btnAddClass.FlatStyle = System.Windows.Forms.FlatStyle.Flat
        Me.btnAddClass.Location = New System.Drawing.Point(64, 144)
        Me.btnAddClass.Name = "btnAddClass"
        Me.btnAddClass.Size = New System.Drawing.Size(75, 23)
        Me.btnAddClass.TabIndex = 1
        Me.btnAddClass.Text = "Add"
        '
        'btnRemoveClass
        '
        Me.btnRemoveClass.FlatStyle = System.Windows.Forms.FlatStyle.Flat
        Me.btnRemoveClass.Location = New System.Drawing.Point(144, 144)
        Me.btnRemoveClass.Name = "btnRemoveClass"
        Me.btnRemoveClass.Size = New System.Drawing.Size(75, 23)
        Me.btnRemoveClass.TabIndex = 2
        Me.btnRemoveClass.Text = "Remove"
        '
        'lstExistingElementClasses
        '
        Me.lstExistingElementClasses.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.lstExistingElementClasses.Location = New System.Drawing.Point(8, 32)
        Me.lstExistingElementClasses.Name = "lstExistingElementClasses"
        Me.lstExistingElementClasses.Size = New System.Drawing.Size(296, 106)
        Me.lstExistingElementClasses.TabIndex = 0
        '
        'Panel1
        '
        Me.Panel1.BackColor = System.Drawing.SystemColors.ControlLight
        Me.Panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.Panel1.Controls.Add(Me.lstOptionTypes)
        Me.Panel1.Controls.Add(Me.lblElementClass)
        Me.Panel1.Controls.Add(Me.cboElementClass)
        Me.Panel1.Controls.Add(Me.lblListName)
        Me.Panel1.Controls.Add(Me.btnEditElement)
        Me.Panel1.Controls.Add(Me.btnAddElement)
        Me.Panel1.Controls.Add(Me.btnRemoveElement)
        Me.Panel1.Controls.Add(Me.lstElementTypes)
        Me.Panel1.Location = New System.Drawing.Point(64, 192)
        Me.Panel1.Name = "Panel1"
        Me.Panel1.Size = New System.Drawing.Size(256, 264)
        Me.Panel1.TabIndex = 10
        '
        'lstOptionTypes
        '
        Me.lstOptionTypes.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.lstOptionTypes.Location = New System.Drawing.Point(8, 88)
        Me.lstOptionTypes.Name = "lstOptionTypes"
        Me.lstOptionTypes.Size = New System.Drawing.Size(240, 132)
        Me.lstOptionTypes.TabIndex = 1
        Me.lstOptionTypes.Visible = False
        '
        'lblElementClass
        '
        Me.lblElementClass.Location = New System.Drawing.Point(8, 8)
        Me.lblElementClass.Name = "lblElementClass"
        Me.lblElementClass.Size = New System.Drawing.Size(232, 16)
        Me.lblElementClass.TabIndex = 6
        Me.lblElementClass.Text = "Select A Class"
        '
        'cboElementClass
        '
        Me.cboElementClass.Items.AddRange(New Object() {"(All Classes)"})
        Me.cboElementClass.Location = New System.Drawing.Point(8, 32)
        Me.cboElementClass.Name = "cboElementClass"
        Me.cboElementClass.Size = New System.Drawing.Size(240, 21)
        Me.cboElementClass.TabIndex = 0
        Me.cboElementClass.Text = "(All Classes)"
        '
        'lblListName
        '
        Me.lblListName.Location = New System.Drawing.Point(8, 64)
        Me.lblListName.Name = "lblListName"
        Me.lblListName.Size = New System.Drawing.Size(184, 16)
        Me.lblListName.TabIndex = 4
        Me.lblListName.Text = "Element Types"
        '
        'btnEditElement
        '
        Me.btnEditElement.FlatStyle = System.Windows.Forms.FlatStyle.Flat
        Me.btnEditElement.Location = New System.Drawing.Point(168, 232)
        Me.btnEditElement.Name = "btnEditElement"
        Me.btnEditElement.Size = New System.Drawing.Size(75, 23)
        Me.btnEditElement.TabIndex = 4
        Me.btnEditElement.Text = "Edit"
        '
        'btnAddElement
        '
        Me.btnAddElement.FlatStyle = System.Windows.Forms.FlatStyle.Flat
        Me.btnAddElement.Location = New System.Drawing.Point(8, 232)
        Me.btnAddElement.Name = "btnAddElement"
        Me.btnAddElement.Size = New System.Drawing.Size(75, 23)
        Me.btnAddElement.TabIndex = 2
        Me.btnAddElement.Text = "Add"
        '
        'btnRemoveElement
        '
        Me.btnRemoveElement.FlatStyle = System.Windows.Forms.FlatStyle.Flat
        Me.btnRemoveElement.Location = New System.Drawing.Point(88, 232)
        Me.btnRemoveElement.Name = "btnRemoveElement"
        Me.btnRemoveElement.Size = New System.Drawing.Size(75, 23)
        Me.btnRemoveElement.TabIndex = 3
        Me.btnRemoveElement.Text = "Remove"
        '
        'lstElementTypes
        '
        Me.lstElementTypes.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.lstElementTypes.Location = New System.Drawing.Point(8, 88)
        Me.lstElementTypes.Name = "lstElementTypes"
        Me.lstElementTypes.Size = New System.Drawing.Size(240, 132)
        Me.lstElementTypes.TabIndex = 0
        '
        'pnlElementTypesOptions
        '
        Me.pnlElementTypesOptions.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.pnlElementTypesOptions.Controls.Add(Me.btnOptions)
        Me.pnlElementTypesOptions.Controls.Add(Me.btnTypes)
        Me.pnlElementTypesOptions.Location = New System.Drawing.Point(8, 192)
        Me.pnlElementTypesOptions.Name = "pnlElementTypesOptions"
        Me.pnlElementTypesOptions.Size = New System.Drawing.Size(57, 264)
        Me.pnlElementTypesOptions.TabIndex = 11
        '
        'btnOptions
        '
        Me.btnOptions.FlatStyle = System.Windows.Forms.FlatStyle.Flat
        Me.btnOptions.Location = New System.Drawing.Point(1, 40)
        Me.btnOptions.Name = "btnOptions"
        Me.btnOptions.Size = New System.Drawing.Size(53, 23)
        Me.btnOptions.TabIndex = 1
        Me.btnOptions.Text = "Options"
        Me.btnOptions.Visible = False
        '
        'btnTypes
        '
        Me.btnTypes.FlatStyle = System.Windows.Forms.FlatStyle.Flat
        Me.btnTypes.Location = New System.Drawing.Point(1, 7)
        Me.btnTypes.Name = "btnTypes"
        Me.btnTypes.Size = New System.Drawing.Size(53, 23)
        Me.btnTypes.TabIndex = 0
        Me.btnTypes.Text = "Types"
        Me.btnTypes.Visible = False
        '
        'frmElementManager
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(328, 494)
        Me.Controls.Add(Me.pnlElementTypesOptions)
        Me.Controls.Add(Me.Panel1)
        Me.Controls.Add(Me.btnOK)
        Me.Controls.Add(Me.pnlElementClasses)
        Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow
        Me.Name = "frmElementManager"
        Me.ShowInTaskbar = False
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent
        Me.Text = "Element Manager"
        Me.pnlElementClasses.ResumeLayout(False)
        Me.Panel1.ResumeLayout(False)
        Me.pnlElementTypesOptions.ResumeLayout(False)
        Me.ResumeLayout(False)

    End Sub

#End Region

    Public Sub New(ByRef CGD As CampaignerGameData)

        Me.New()

        ptrCGD = CGD

        ' list the classes and types
        ListClasses()
        ListTypes()

    End Sub

    Private Sub ListClasses()
        ' lists classes in the list and in the element types dropdown
        Dim ElClasso As ElementClass

        Try
            lstExistingElementClasses.Items.Clear()
            cboElementClass.Items.Clear()

            cboElementClass.Items.Add("(All Classes)")

            For Each ElClasso In ptrCGD.ElementMan.DefinedElementClasses
                lstExistingElementClasses.Items.Add(ElClasso)
                cboElementClass.Items.Add(ElClasso)
            Next
        Catch ex As Exception
            HandleException(c_Module, ex)
        End Try

    End Sub

    Private Sub ListTypes(Optional ByVal forClassName As String = "(All Classes)")
        Dim ElTypo As ElementType
        Dim ElOpto As ElementOptionType

        Try
            lstElementTypes.Items.Clear()
            ' list elementtypes
            For Each ElTypo In ptrCGD.ElementMan.DefinedElementTypes
                ' do our checking
                If forClassName <> "(All Classes)" Then
                    If ElTypo.ElementClassName = forClassName Then
                        lstElementTypes.Items.Add(ElTypo)
                    End If
                Else
                    lstElementTypes.Items.Add(ElTypo)
                End If
            Next
            'list option types
            lstOptionTypes.Items.Clear()
            For Each ElOpto In ptrCGD.ElementMan.DefinedElementOptions
                ' do za chekkin
                If forClassName <> "(All Classes)" Then
                    If ElOpto.ElementClassName = forClassName Then
                        lstOptionTypes.Items.Add(ElOpto)
                    End If
                Else
                    lstOptionTypes.Items.Add(ElOpto)
                End If
            Next
        Catch nullEx As NullReferenceException
            ' we can ignore this one for now.
        Catch ex As Exception
            HandleException(c_Module, ex)
        End Try

    End Sub

    Private Sub ListOptions(Optional ByVal forClassName As String = "(All Classes)")
        Dim Opto As ElementOptionType

        Try
            lstOptionTypes.Items.Clear()

            For Each Opto In ptrCGD.ElementMan.DefinedElementOptions
                ' yappa chekkin, duh
                If forClassName <> "(All Classes)" Then
                    If Opto.ElementClassName = forClassName Then
                        lstOptionTypes.Items.Add(Opto)
                    End If
                Else
                    lstOptionTypes.Items.Add(Opto)
                End If
            Next

        Catch nullEx As NullReferenceException
            ' igNORe
        Catch ex As Exception
            HandleException(c_Module, ex)
        End Try

    End Sub

#Region "Element Classes"
    Private Sub btnAddClass_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAddClass.Click
        Dim NewClass As New ElementClass()

        Try
            NewClass.ElementClassDescription = "New Element Class Description"
            NewClass.ElementClassName = "New Element Class"

            Dim fNew As New frmAddElementClass(NewClass)
            fNew.ShowDialog()

            ' now add the beeeoootch
            ptrCGD.ElementMan.DefinedElementClasses.Add(NewClass)
        Catch ex As Exception
            HandleException(c_Module, ex)
        End Try

        ' and repopulate
        ListClasses()

    End Sub

    Private Sub btnRemoveClass_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRemoveClass.Click
        ' there must an item selected in the class listview
        Try
            If Not lstExistingElementClasses.SelectedItem Is Nothing Then
                Dim elClasso As ElementClass = lstExistingElementClasses.SelectedItem

                If MessageBox.Show("Do you wish to delete this class: " & elClasso.ToString & "?", "Delete Class", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) = DialogResult.Yes Then
                    ptrCGD.ElementMan.DefinedElementClasses.Remove(elClasso)
                    ListClasses()
                End If
            End If
        Catch ex As Exception
            HandleException(c_Module, ex)
        End Try

    End Sub

    Private Sub btnEdit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEdit.Click
        Try
            If Not lstExistingElementClasses.SelectedItem Is Nothing Then
                Dim elClasso As ElementClass = lstExistingElementClasses.SelectedItem
                Dim fEditClass As New frmAddElementClass(elClasso)
                Dim oldClassName As String = elClasso.ElementClassName

                fEditClass.ShowDialog()

                ' if the name was changed, all element types and option types that use that name must have theirs changed
                If oldClassName <> elClasso.ElementClassName Then
                    Dim eltypo As ElementType
                    For Each eltypo In ptrCGD.ElementMan.DefinedElementTypes
                        If eltypo.ElementClassName = oldClassName Then eltypo.ElementClassName = elClasso.ElementClassName
                    Next
                    Dim elOpto As ElementOptionType
                    For Each elOpto In ptrCGD.ElementMan.DefinedElementOptions
                        If elOpto.ElementClassName = oldClassName Then elOpto.ElementClassName = elClasso.ElementClassName
                    Next
                End If
                ListClasses()
            End If
        Catch ex As Exception
            HandleException(c_Module, ex)
        End Try
    End Sub
#End Region

#Region "Element Types and Option Types"

    Private Sub btnRemoveElement_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRemoveElement.Click
        If LowerPanelShowMode = ShowMode.ElementTypes Then
            RemoveElementType()
        Else
            RemoveOptionType()
        End If
    End Sub

    Private Sub btnEditElement_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEditElement.Click
        If LowerPanelShowMode = ShowMode.ElementTypes Then
            EditElementType()
        Else
            EditOptionType()
        End If
    End Sub

    Private Sub btnAddElement_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAddElement.Click
        If ptrCGD.ElementMan.DefinedElementClasses.Count = 0 Then
            MessageBox.Show("There are no Element Classes defined. You must have at least one Element Class defined.", "No Element Classes")
            Exit Sub
        End If

        If LowerPanelShowMode = ShowMode.ElementTypes Then
            AddElementType()
        Else
            AddOptionType()
        End If
    End Sub

    Private Sub RemoveElementType()
        Try
            If Not lstElementTypes.SelectedItem Is Nothing Then
                Dim elTypo As ElementType = lstElementTypes.SelectedItem
                ' ask first
                If MessageBox.Show("Are you sure you want to delete this Element Type: " & elTypo.ElementTypeName & "?", "Delete Element Type", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = DialogResult.Yes Then
                    ptrCGD.ElementMan.DefinedElementTypes.Remove(elTypo)
                    ListTypes(cboElementClass.Text)
                End If
            End If
        Catch ex As Exception
            HandleException(c_Module, ex)
        End Try
    End Sub

    Private Sub AddElementType()
        Dim newItem As New ElementType()

        Try
            ' if the user selects a filter, we will default the class to the filter. Very cool.
            If cboElementClass.Text <> "(All Classes)" Then
                newItem.ElementClassName = cboElementClass.Text
            Else
                newItem.ElementClassName = "(None Selected)"
            End If
            newItem.ElementDescription = "New Element Type Description"
            newItem.ElementTypeName = "New Element Type"

            Dim fAddElTypo As New frmAddElementType(newItem, ptrCGD.ElementMan.DefinedElementClasses)
            fAddElTypo.ShowDialog()

            ' add the sukka
            ptrCGD.ElementMan.DefinedElementTypes.Add(newItem)
            ListTypes(cboElementClass.Text)
        Catch ex As Exception
            HandleException(c_Module, ex)
        End Try

    End Sub

    Private Sub EditElementType()
        Try
            If Not lstElementTypes.SelectedItem Is Nothing Then
                Dim elTypo As ElementType = lstElementTypes.SelectedItem
                Dim fEditTypo As New frmAddElementType(elTypo, ptrCGD.ElementMan.DefinedElementClasses)
                fEditTypo.ShowDialog()
                ListTypes(cboElementClass.Text)

            End If
        Catch ex As Exception
            HandleException(c_Module, ex)
        End Try
    End Sub


    Private Sub RemoveOptionType()
        Try
            If Not lstOptionTypes.SelectedItem Is Nothing Then
                Dim opto As ElementOptionType = lstOptionTypes.SelectedItem
                ' ask? If we have to.
                If MessageBox.Show("Are you sure you want to delete this Option Type: " & opto.ElementOptionTypeName & "?", "Delete Option Type", MessageBoxButtons.YesNo) = DialogResult.Yes Then
                    ptrCGD.ElementMan.DefinedElementOptions.remove(opto)
                    ListOptions(cboElementClass.Text)
                End If
            End If
        Catch ex As Exception
            HandleException(c_Module, ex)
        End Try
    End Sub

    Private Sub AddOptionType()
        Dim newItem As New ElementOptionType()

        Try
            ' don't forget my COOL filter option
            If cboElementClass.Text <> "(All Classes)" Then
                newItem.ElementClassName = cboElementClass.Text
            Else
                newItem.ElementClassName = "(None Selected)"
            End If
            newItem.ElementOptionTypeName = "New Option Type"
            newItem.ElementPointCost = 0

            Dim fAddOpto As New frmEditOptionType(newItem, ptrCGD.ElementMan.DefinedElementClasses)
            fAddOpto.ShowDialog()

            ' add the sukka
            ptrCGD.ElementMan.DefinedElementOptions.Add(newItem)
            ListTypes(cboElementClass.Text)

        Catch ex As Exception

        End Try

    End Sub

    Private Sub EditOptionType()
        Try
            If Not lstOptionTypes.SelectedItem Is Nothing Then
                Dim opto As ElementOptionType = lstOptionTypes.SelectedItem
                Dim fEditOption As New frmEditOptionType(opto, ptrCGD.ElementMan.DefinedElementClasses)
                fEditOption.ShowDialog()
                ListTypes(cboElementClass.Text)
            End If
        Catch ex As Exception
            HandleException(c_Module, ex)
        End Try
    End Sub

#End Region

    Private Sub btnOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOK.Click
        Me.Hide()
    End Sub

    Private Sub cboElementClass_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cboElementClass.SelectedIndexChanged
        ListTypes(cboElementClass.Text)
    End Sub

    Private Property LowerPanelShowMode() As ShowMode
        Get
            Return currentShowMode
        End Get
        Set(ByVal Value As ShowMode)
            currentShowMode = Value
            If currentShowMode = ShowMode.ElementTypes Then
                lstOptionTypes.Visible = False
                lstElementTypes.Visible = True
                lblListName.Text = "Element Types"

            Else
                lstOptionTypes.Visible = True
                lstElementTypes.Visible = False
                lblListName.Text = "Option Types"
            End If
        End Set
    End Property

    Private Sub btnTypes_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTypes.Click
        LowerPanelShowMode = ShowMode.ElementTypes
    End Sub

    Private Sub btnOptions_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOptions.Click
        LowerPanelShowMode = ShowMode.Options
    End Sub

End Class
